﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;

public partial class Account_Login : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        //RegisterHyperLink.NavigateUrl = "Register.aspx?ReturnUrl=" + HttpUtility.UrlEncode(Request.QueryString["ReturnUrl"]);

        if (!IsPostBack)
        {
            //auto login
            string aduser = Request.ServerVariables["LOGON_USER"];

            if (!string.IsNullOrEmpty(aduser))
            {
                FormsAuthentication.SetAuthCookie(aduser.Split('\\')[1], false);
                Response.Redirect(FormsAuthentication.DefaultUrl);
            }
        }
    }
}
